function z_view() {
    let node = this.findList();
    let res = node.querySelectorAll(":nth-child(n+2)");
    viewData = [];
    for (var i = 0; i < res.length; i++) {
        res[i].setAttribute('z_view', 'true');
        viewData.push(this.getDateOfView(res[i]));
    }
    return viewData;
}

z_view.prototype.findList = function() {
    let all = document.querySelectorAll('.cover-wp');
    res = [];
    for (let i in all) {
        if (i == 'length') {
            return [];
        }
        let list = this.toList(all[i]);
        if (list) {
            return list;
        }
        // if (list && (res.length == 0 || (res.length > 0 && list != res[i - 1]))) {
        //     res[i] = list;
        // }
    }
    return res;
}
z_view.prototype.toList = function(node) {
    for (let i = 0; i < 9; i++) {
        if (node.hasChildNodes() && node.childElementCount > 9) {
            if (this.similarForList(node.children)) {
                return node;
            }
        } else {
            if (node.parentElement == null) {
                return false;
            }
            node = node.parentElement;
        }
    }
}
/**
    判断元素是否相似
*/
z_view.prototype.similarForList = function(node) {
    for (var i in node) {
        if (node[i + 1]) {
            if (!this.similar(node[i], node[i + 1])) {
                return false;
            }
        }
    }
    return true;
}
/**
    判断元素是否相似
*/
z_view.prototype.similar = function(node, nodep) {
    if (node.childElementCount == nodep.childElementCount && node.tagName == nodep.tagName) {
        return true;
    } else {
        return false;
    }
}
/**
    丛试图中获取 想要的data数据
*/
z_view.prototype.getDateOfView = function(node, res, keyStr) {
    if (!keyStr) {
        keyStr = "";
    }
    keyStr += '-' + node.tagName;
    if (!res) {
        res = {};
    }
    if (node.innerHTML) {
        res[keyStr] = node.innerText.replace(/\s+/g, "");
    }
    if (node.tagName == 'IMG') {
        res[keyStr] = node.getAttribute('src');
    }
    for (var i in node.children) {
        this.getDateOfView(node.children[i], res, keyStr + "_" + i);
    }
    return res;
}
new z_view();